From 9956336767adc87ba708751c7a394faa6661804e Mon Sep 17 00:00:00 2001 From: "emellor@ewan" Date: Sat, 17 Sep 2005 18:09:31 +0100 Subject: [PATCH] Replace XendDomainInfo.setStoreChannel with XendDomainInfo.closeStoreChannel. setStoreChannel was only ever called with channel=None (implying that the current channel would be closed) so the other code there was superfluous. Signed-off-by: Ewan Mellor --- tools/python/xen/xend/XendCheckpoint.py | 2 +- tools/python/xen/xend/XendDomainInfo.py | 26 ++++++++++++++----------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/tools/python/xen/xend/XendCheckpoint.py b/tools/python/xen/xend/XendCheckpoint.py index 4a890c7bba..0c4f5aa059 100644 --- a/tools/python/xen/xend/XendCheckpoint.py +++ b/tools/python/xen/xend/XendCheckpoint.py @@ -83,7 +83,7 @@ def save(xd, fd, dominfo, live): if child.wait() != 0: raise XendError("xc_save failed: %s" % lasterr) - dominfo.setStoreChannel(None) + dominfo.closeStoreChannel() xd.domain_destroy(dominfo.domid) return None diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py index 564d654001..330736700b 100644 --- a/tools/python/xen/xend/XendDomainInfo.py +++ b/tools/python/xen/xend/XendDomainInfo.py @@ -348,15 +348,20 @@ class XendDomainInfo: self.store_mfn = ref self.storeDom("store/ring-ref", ref) - def setStoreChannel(self, channel): - if self.store_channel and self.store_channel != channel: - self.store_channel.close() - self.store_channel = channel - if channel: - port = channel.port1 - else: - port = None - self.storeDom("store/port", None) + + def closeStoreChannel(self): + """Close the store channel, if any. Nothrow guarantee.""" + + try: + if self.store_channel: + try: + self.store_channel.close() + self.removeDom("store/port") + finally: + self.store_channel = None + except Exception, exn: + log.exception(exn) + def setConsoleRef(self, ref): self.console_mfn = ref @@ -763,8 +768,7 @@ class XendDomainInfo: """ self.state = STATE_VM_TERMINATED self.release_devices() - if self.store_channel: - self.setStoreChannel(None) + self.closeStoreChannel() if self.console_channel: # notify processes using this console? try: -- 2.30.2